
# -*- coding: UTF-8 -*-
import xml.etree.cElementTree as et
import os
json_path="/home/wangbo/tianchi/Annotations" #xml文件路径

#遍历xml文件
for filename in os.listdir(json_path):
    path=json_path+'/'+filename #定位到每一个xml文件
    tree=et.parse(path)
    root=tree.getroot()
    for r in root.findall('object'):
        r[0].text='bad'
        print r[0].text
    tree.write(path)
